<template>
	<view class="f-f-c p20">
		<u-navbar
		:autoBack="true" bgColor="#fff"
		leftIconColor='#000'
		:titleStyle="{ color: '#000'}"
		 title="消息" rightText='' :border="false" :placeholder="true">
			<!-- <view slot="left"></view> -->
			<!-- <view slot="right" style="display: flex;">
				<u-icon name="clock" color="#fff" size="16" style="margin: 0 5px;"></u-icon>
				<u-icon name="plus-circle" color="#fff" size="16"></u-icon>
			</view> -->
		</u-navbar>
		<view class="">
			<view class="m20 p20 b-s b-rd f-s-b" v-for="item,ix in datalist" @click="navTo('/pagesA/user/messageDetail?data=' +JSON.stringify(item) )">
				<image src="https://chaoyuanhuishou.oss-cn-beijing.aliyuncs.com/head.png" style="width: 120rpx;" mode="widthFix"></image>
			    <view class="f1 ml20 ">
			    	<view class="f-s-b">
			    		<span class="f24">{{item.noticeTitle}}</span>
						<span class="c9 f24" style="text-align: right;">{{item.updateTime}}</span>
			    	</view>
					<view class="mt20 f28 c9 f">
						<view class="" v-html="item.noticeContent">
							
						</view>
					  <u-badge class="ml20" :type="type" max="99" :value="value2"></u-badge>
					</view>
			    </view>
			</view>
			
		</view>
	
		
	</view>
</template>


<script>
	 export default {
		data() {
			return {
				list1:[ ],
				high:0,
				show:false,
				value:null,
				value2:2,
				type:null,
				datalist:[],
				interval:null
			}
		},
		onReachBottom() {
			
		},
		onReady() {
			
		},
		onLoad(){
			
		},
		onShow() {
			this.getList()
		},
		methods: {
			genInterval(){
				if(this.interval == null){
					this.interval = setInterval(() => {
						this.getList()
					},1000)
				}
			},
			clearInterval(){
				console.log("销毁")
				if(this.interval != null){
					clearInterval(this.interval)
					this.interval = null
				}
			},
			getList(){
				let that = this
				this.$api.request('get', 'notice/app/list',{
					
				}).then(res => {
				  console.log(res.rows)
				  this.datalist = res.rows
				  this.genInterval()
				}).catch(err => {
				  this.$api.msg('请求失败，请稍后再试')
				})
			}
		},
		destroyed() {
			console.log("销毁")
			this.clearInterval()
		}
	
		
	}
</script>

<style lang='scss'>
	page,
	.content {
		min-height: 50%;
		background-color: #f8f8f8;
	}

	.btn{
		width: 100%;
		height: 68rpx;
		background: #1AC388;
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		opacity: 1;
		border: 2rpx solid var(--theme);
		text-align: center;
		line-height: 68rpx;
		color:#fff;
	}
	.btn2{
		width: 100%;
		height: 68rpx;
		background: rgba(26,195,136,0);
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		opacity: 1;
		border: 2rpx solid var(--theme);
		text-align: center;
		line-height: 68rpx;
		color: var(--theme);
	}
	
</style>
